// 用户信息的业务层方法
const userDao = require('../dao/userDao');
module.exports.findByUsername = async function(username){
    let data = await userDao.findByUsername(username);
    return data;
}
module.exports.login = async function(username,pwd){
    let data = await userDao.findByUsername(username);
    if(data.length > 0 && data[0].pwd == pwd){
        return data[0];
    }else{
        return {};
    }
}
module.exports.register = async function(user){
    return await userDao.insert(user);
}
module.exports.findById = async function(id){
    return await userDao.findById(id);
}
module.exports.update = async function(user){
    return await userDao.update(user);
}